package com.song.tools.songtest.convertor;

import com.song.tools.mvc.convertor.EntityConvertor;
import com.song.tools.mvc.convertor.QueryConvertor;
import com.song.tools.mvc.convertor.SaveConvertor;
import com.song.tools.songtest.beans.bo.OperateLogBo;
import com.song.tools.songtest.beans.query.OperateLogQuery;
import com.song.tools.songtest.beans.request.OperateLogQueryRequest;
import com.song.tools.songtest.beans.request.OperateLogSaveRequest;
import com.song.tools.songtest.beans.response.OperateLogQueryResponse;
import com.song.tools.songtest.beans.response.OperateLogSaveResponse;
import com.song.tools.songtest.dao.entity.OperateLog;
import org.mapstruct.AfterMapping;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;

import java.util.List;

/**
 * <p>
 * 操作日志表 转换器
 * </p>
 *
 * @author song tools
 * @since 2024-07-16
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public abstract class OperateLogConvertor implements QueryConvertor<OperateLogBo, OperateLogQuery, OperateLogQueryRequest, OperateLogQueryResponse>,
        EntityConvertor<OperateLog, OperateLogBo>, SaveConvertor<OperateLogBo, OperateLogSaveRequest, OperateLogSaveResponse> {

    @Override
    public abstract OperateLog entityBoToEntity(OperateLogBo operateLogBo);

    @Override
    public abstract OperateLogBo entityToEntityBo(OperateLog operateLog);

    @Override
    public abstract OperateLogQueryResponse entityBoToQueryResponse(OperateLogBo operateLogBo);

    @Override
    public abstract OperateLogQuery queryRequestToQuery(OperateLogQueryRequest queryRequest);

    @Override
    public abstract OperateLogBo saveRequestToEntityBo(OperateLogSaveRequest request);

    @Override
    public abstract OperateLogSaveResponse entityBoToSaveResponse(OperateLogBo operateLogBo);

    @Override
    public abstract List<OperateLog> entityBoToEntity(List<OperateLogBo> entityBo);

    @Override
    public abstract List<OperateLogBo> entityToEntityBo(List<OperateLog> entity);

    @AfterMapping
    public void afterMappingEntityBoToEntity(@MappingTarget OperateLog operateLog, OperateLogBo operateLogBo) {
        // entityBoToEntity() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToEntity()
    }

    @AfterMapping
    public void afterMappingEntityToEntityBo(@MappingTarget OperateLogBo operateLogBo, OperateLog operateLog) {
        // entityToEntityBo() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityToEntityBo()
    }

    @AfterMapping
    public void afterMappingQueryRequestToQuery(@MappingTarget OperateLogQuery operateLogQuery, OperateLogQueryRequest operateLogQueryRequest) {
        // queryRequestToQuery() 内部其它代码执行完之后，最后会自动执行 afterMappingQueryRequestToQuery()
    }

    @AfterMapping
    public void afterMappingEntityBoToQueryResponse(@MappingTarget OperateLogQueryResponse operateLogQueryResponse, OperateLogBo operateLogBo) {
        // entityBoToQueryResponse() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToQueryResponse()
    }

    @AfterMapping
    public void afterMappingEntityBoToSaveResponse(@MappingTarget OperateLogSaveResponse operateLogSaveResponse, OperateLogBo operateLogBo) {
        // entityBoToSaveResponse() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToSaveResponse()
    }

    @AfterMapping
    public void afterMappingSaveRequestToEntityBo(@MappingTarget OperateLogBo operateLogBo, OperateLogSaveRequest operateLogSaveRequest) {
        // saveRequestToEntityBo() 内部其它代码执行完之后，最后会自动执行 afterMappingSaveRequestToEntityBo()
    }
}
